package a02_Thread;

/**
 * @Author quan
 * @Description start与run方法的区别
 * @Date 2023/4/28 14:12
 */
public class Demo8_StartRun {
    public static void main(String[] args) {
        Thread thread = new Thread(()->{
            while (true){
//            for (int i = 0; i < 5; i++) {
                System.out.println("hello thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        /**
         * 注意两者的区别
         */
//        thread.start();
        thread.run();
        System.out.println("线程状态:"+thread.getState());
        System.out.println("主线程结束");
    }
}
